package org.young.rbac.service.impl.work;

import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.young.common.constant.DubboRpcConstant;
import org.young.rbac.api.base.SysUserService;
import org.young.rbac.api.work.SysUserWorkService;
import org.young.rbac.dao.model.SysUser;
import org.young.rbac.dao.model.SysUserExample;

/**
 * @author lmhd-emp
 * @date 2021/5/12 13:09
 * @description:
 */
@Component
@DubboService(interfaceClass = SysUserWorkService.class, version = DubboRpcConstant.DEFAULT_RPC_VERSION, timeout = DubboRpcConstant.DEFAULT_RPC_TIMEOUT)
public class SysUserWorkServiceImpl implements SysUserWorkService {

	@Autowired
	SysUserService sysUserService;

	@Override public SysUser getUserByUsername(String username) {
		if (StringUtils.isBlank(username)) {
			return null;
		}
		SysUserExample sysUserExample = new SysUserExample();
		sysUserExample.createCriteria().andUsernameEqualTo(username.trim());
		return sysUserService.selectFirstByExample(sysUserExample);
	}
}
